#!/bin/sh
echo "首先准备数据的配置变量"
db3="dm01"
t1="dm_cust_info"  #客户分析表
t2="dm_addr_info" #地域分析表
echo "创建dm层的客户分析表"
c_dmt1="create table if not exists ${db3}.${t1}(
dm_cust_id int,
dm_cust_name string,
dm_amt DECIMAL,
dm_cust_ck DECIMAL,
dm_cust_lc DECIMAL,
dm_cust_qk DECIMAL,
dm_cust_zz DECIMAL,
dm_etl_time timestamp
)
row format delimited fields terminated by ',';"
#使用hive指令进行创建
echo "$c_dmt1"|hive 
echo $?
echo "dm层客户基表已创建完成"
echo"----------------------分割线---------------"
echo"创建dm地域分析表------------------------"
c_dmt2="create table if not exists ${db3}.${t2}(
dm_org_name string,
dm_org_addr string,
dm_sum_qk DECIMAL,
dm_sum_aqk DECIMAL,
dm_sum_ack DECIMAL,
dm_sum_ck DECIMAL,
dm_sum_dgzz DECIMAL,
dm_sum_dszz DECIMAL,
dm_sum_dzz DECIMAL,
dm_sum_lc DECIMAL,
dm_sum_dck DECIMAL,
dm_etl_time timestamp
)
row format delimited fields terminated by ',';"
#使用hive -e 指令进行创建
hive -e "$c_dmt2"
echo $?
echo "dm地域分析表已创建完成"